<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>登录-聊天房</title>
    <style>
        body { text-align: center; }
        .tab1 {
            width: auto;
            margin: 0 auto;
            border-spacing: 5px 20px;
        }

    </style>
</head>
<body style="">
<h2>登录聊天房</h2>
<form id="login_form" method="post" action="login">
    <table class="tab1">
        <tr>
            <td>输入昵称</td>
            <td><input type="text" name="nickname" id="nickname"/></td>
        </tr>
        <tr>
            <td colspan="2">
                <button id="login_btn">登录</button>
            </td>
        </tr>
    </table>
</form>
</body>
<script type="text/javascript" src="js/util.js"></script>
<script type="text/javascript">
    var errorMsg = decodeURIComponent(getSearchParam("error_msg"));
    if (errorMsg) {
        alert(errorMsg);
    }

    var login_btn = document.getElementById("login_btn");
    login_btn.onclick = function() {
        if (all && all()) {
            return false;
        }
        document.getElementById("nickname").value = document.getElementById("nickname").value.trim();
        if (document.getElementById("nickname").value == "")
        {
            alert("请输入昵称");
            return false;
        }
        document.getElementById("login_form").submit();
    };
</script>
</html>